package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/**
 * @description: TODO
 * @author yumo
 * @version: 1.0
 * @date 2025/3/12 11:58
 */
public class NewForDemo {
    public static void main(String[] args) {
        String[]array={"one","two","three","four"};
        for (int i=0;i<array.length;i++){
            System.out.println(array[i]);
        }
        for (String str:array){
            System.out.println(str);
        }
        System.out.println("___________");
        Collection<String> c=new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        Iterator<String>it=c.iterator();
        while (it.hasNext()){
            System.out.println(it.next());
        }
        for (String str:c){
            System.out.println(str);
        }
        System.out.println("_____________");
        Collection<String>b=new ArrayList<>();
        b.add("SortInteger1");
        b.add("bbb");
        b.add("ccc");
        Iterator<String>its=b.iterator();
        while (its.hasNext()){
            System.out.println(its.next());
        }
        for (String x:b){
            System.out.println(x);
        }
    }
}
